<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表循环</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="app">
    <!--为了加强循环渲染的性能，会为每个循环项上加一个唯一的key值（不推荐使用index作为key值，推荐使用id作为key值）-->
    <template v-for="(item,index) of list" :key="item.id">
        <div>
            {{item.value}}--{{index}}
        </div>
        <span>
            {{item.value}}
        </span>
    </template>
</div>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            list: [
                {
                    id: "1",
                    value: "l"
                },
                {
                    id: "2",
                    value: "y"
                },
                {
                    id: "3",
                    value: "c"
                }
            ]
        }
    });
</script>
</body>
</html>